<template>
    <div class="tourist_box">
        <div class="top">
            <p class="title">实时游客统计</p>
            <p class="bg"></p>
            <p class="right">可预约总量<span>99999</span>人</p>
        </div>
        <div class="number">
            <span v-for="(item, index) in people" :key="index">{{ item }}</span>
        </div>
        <!-- echarts展示图表 -->
        <div class="charts" ref="charts">

        </div>
    </div>
</template>
<script setup lang='ts' name='tourist'>
import { onMounted, ref } from 'vue';
import * as echarts from 'echarts'
//水球图拓展插件
import 'echarts-liquidfill'
let people = ref('201452人')
//获取节点
let charts = ref()
onMounted(() => {
    //获取echarts类的实例
    let mycharts = echarts.init(charts.value)
    // 设置实例的配置项
    mycharts.setOption({
        //决定你展示什么样的图形图标
        series: {
            type: 'liquidFill',
            name: '预约量',
            color: ['#294D99'],//水中的颜色
            data: [ 0.5],
            label: {
                formatter: '{a}',
                fontSize: 20
            },
            waveAnimation: true,//动画
            animationDuration: 3,//持续时间
            animationDurationUpdate: 0,
            radius: '90%',//半径
            outline: {//外层边框颜色设置
                show: true,
                borderDistance: 8,
                itemStyle: {
                    color: 'skyblue',
                    borderColor: '#294D99',
                    borderWidth: 8,
                    shadowBlur: 20,
                    shadowColor: 'rgba(0, 0, 0, 0.25)'
                }
            },
            backgroundStyle: {
                color: '#E3F7FF'
            },
        },
        //布局组件
        grid: {
            left: 0,
            top: 0,
            right: 0,
            bottom: 0,
        }
    })
})
</script>


<style scoped lang="scss">
.tourist_box {
    background: url(../../images/dataScreen-main-lb.png) no-repeat;
    background-size: 100% 100%;
    margin-top: 10px;

    .top {
        margin-left: 20px;

        .title {
            color: white;
            font-size: 20px;
        }

        .bg {
            width: 68px;
            height: 7px;
            background: url(../../images/dataScreen-title.png);
            background-size: 100% 100%;
            margin-top: 10px;
        }

        .right {
            float: right;
            color: white;
            font-size: 20px;

            span {
                color: yellowgreen;
                margin: 0 3px;
            }
        }
    }

    .number {
        margin-top: 30px;
        display: flex;
        padding: 20px;

        span {
            flex: 1;
            height: 60px;
            text-align: center;
            line-height: 60px;
            background: url(../../images/total.png) no-repeat;
            background-size: 100% 100%;
            color: #29fcff;
            font-size: 35px;
        }
    }

    .charts {
        width: 100%;
        height: 210px;
    }
}
</style>